﻿using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem
{
    /// <summary>
    /// DrugAndEventWindow.xaml 的交互逻辑
    /// </summary>
    public partial class DrugAndEventWindow : BaseToolWindow
    {

        #region Variables

        private static DrugAndEventWindow _instance;
        private object _title;

        #endregion

        #region Constructor

        public DrugAndEventWindow()
        {
            InitializeComponent();
            this.ContentRendered += DrugAndEventWindow_ContentRendered;
            this.Collapsed += DrugAndEventWindow_Collapsed;
        }

        #endregion

        #region Properties

        public static DrugAndEventWindow Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new DrugAndEventWindow();
                }
                return _instance;
            }
        }

        public object CusContent
        {
            get
            {
                return this.Content;
            }
            set
            {
                this.Content = value;
            }
        }

        public new object Title
        {
            get
            {
               return _title;
            }
            set
            {
                _title = value;
            }
        }

        #endregion

        #region 依赖属性

        #endregion

        #region Event



        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers

        private void DrugAndEventWindow_Collapsed(object sender, EventArgs e)
        {
            //this.Content = null;
        }

        private void DrugAndEventWindow_ContentRendered(object sender, EventArgs e)
        {
            base.Title = _title;
            this.Width = (this.Content as FrameworkElement).ActualWidth;
            this.Height = (this.Content as FrameworkElement).ActualHeight+50;
            Top = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - Height) / 2;
            Left = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - Width) / 2;
        }

        #endregion
    }
}
